clear all
set more off
capture log close
 

 ***/*
 ***This do file includes Stata codes for Tables 1-7 and Figures 1-2. 
 ****/
 cd "[[FILL IN YOUR DIRECTORY]]/Data"
 
 
 
 
 
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////Table 1 ////////////////////////////////////
 

***Table 1: Summary statistics for married couples


/*Part 1: PSID Data*/
use PSID_Donation_with_Bartik_Cleaned.dta, clear
svyset ER31997 [pweight=family_weight], singleunit(certainty) strata(ER31996)
label var male_age "Husband age"
label var fem_age "Wife age"
label var male_race_white "Husband white"
label var fem_race_white "Wife white"
label var male_race_black "Husband black"
label var fem_race_black "Wife black"
label var male_race_hisp "Husband hispanic"
label var fem_race_hisp "Wife hispanic"
label var fam_income1000 "After-tax family income"

foreach var of varlist fam_income1000_beforetax fam_income1000 fam_size male_age fem_age male_hs_grad male_attended_college male_college_grad fem_hs_grad fem_attended_college ///
 fem_college_grad male_race_white male_race_black male_race_hisp fem_race_white  fem_race_black fem_race_hisp  male_labor_income fem_labor_income primary_earner_male  male_churchgoer fem_churchgoer price_giving  {
local label`var':variable label `var'    
}

svy: mean fam_income1000_beforetax fam_income1000 fam_size male_age fem_age male_hs_grad male_attended_college male_college_grad fem_hs_grad  fem_attended_college ///
 fem_college_grad male_race_white male_race_black male_race_hisp fem_race_white  fem_race_black fem_race_hisp  male_labor_income fem_labor_income primary_earner_male  male_churchgoer fem_churchgoer price_giving   
estat sd
mat mean=r(mean)'
mat sd=r(sd)'
local n=rowsof(sd)
mat est=J(`n',2,.)
mat colnames est=Mean SD
forval i=1/	`n'{
mat est[`i',1]=mean[`i',1]
mat est[`i',2]=sd[`i',1]
}
mat list est, format(%12.3fc)
mat rownames est="`labelfam_income1000_beforetax'" "`labelfam_income1000'" "`labelfam_size'" "`labelmale_age'" "`labelfem_age'" "`labelmale_hs_grad'" "`labelmale_attended_college'" "`labelmale_college_grad'" "`labelfem_hs_grad'"  "`labelfem_attended_college'"  "`labelfem_college_grad'" "`labelmale_race_white'" "`labelmale_race_black'"  "`labelmale_race_hisp'" "`labelfem_race_white'"   "`labelfem_race_black'" "`labelfem_race_hisp'"   "`labelmale_labor_income'" "`labelfem_labor_income'"  "`labelprimary_earner_male'"  "`labelmale_churchgoer'"   "`labelfem_churchgoer'"    "`labelprice_giving'" 
mat list est, format(%12.3fc)
esttab matrix(est, fmt(2)) 


/*Part 2: ACS Data*/
use ACS_2003_2019.dta, clear
tab year 
rename year ACS_waveyear
gen year=ACS_waveyear-1 
keep if marst==1 
tab relate
keep if relate==1 | relate==2 
sort year serial
quietly by year serial:  gen dup = cond(_N==1,0,_n)
tab dup
drop if dup==0 
drop dup
sort year serial sex
quietly by year serial sex:  gen dup = cond(_N==1,0,_n)
tab dup
tab year if dup!=0
drop if dup!=0 
drop dup
gen male=(sex==1)

* age
tab age
gen age_25_60_head=(age>=25 & age<=60 & male==1) 
bysort year serial: egen max_age_25_60_head=max(age_25_60_head)
keep if max_age_25_60_head==1
drop max_age_25_60_head 
gen male_age=age if male==1
gen fem_age=age if male==0
label var male_age "Husband age"
label var fem_age "Wife age"

* race
rename race raceg
rename hispan hispang
gen racecat=1 if raceg==1
replace racecat=2 if raceg==2
replace racecat=3 if (hispang>0 & hispang<=4)
replace racecat=4 if (raceg==4 | raceg==5 | raceg==6)
replace racecat=5 if (raceg==7 | raceg==3| raceg==8| raceg==9)
label define racel 1 white 2 black 3 hisp 4 asian 5 other
label values racecat racel
gen male_race_white=(racecat==1) if male==1 
gen male_race_black=(racecat==2) if male==1
gen male_race_hisp=(racecat==3) if male==1 
gen fem_race_white=(racecat==1) if male==0 
gen fem_race_black=(racecat==2) if male==0 
gen fem_race_hisp=(racecat==3) if male==0
label var male_race_white "Husband white"
label var fem_race_white "Wife white"
label var male_race_black "Husband black"
label var fem_race_black "Wife black"
label var male_race_hisp "Husband hispanic"
label var fem_race_hisp "Wife hispanic"

* income
sum incwage
gen male_labor_income=incwage if male==1
gen fem_labor_income=incwage if male==0
gen fam_income1000_beforetax=ftotinc 
label var fam_income1000_beforetax "Before-tax family income"
label var male_labor_income "Husband labor income"
label var fem_labor_income "Wife labor income"

* family size 
gen fam_size=famsize
label var fam_size "Family size"

* primary earner is male 
sort year serial male
sort year serial 
quietly by year serial:  gen dup = cond(_N==1,0,_n)
drop dup
gen primary_earner_male=1 if serial==serial[_n+1] & (male_labor_income[_n+1]>fem_labor_income) & male_labor_income[_n+1]!=. & fem_labor_income!=.
replace primary_earner_male=0 if serial==serial[_n+1] & (male_labor_income[_n+1]<=fem_labor_income) & male_labor_income[_n+1]!=. & fem_labor_income!=.
label var primary_earner_male "Primary earner is male, measured by labor income"
bysort year serial: egen max_primary_earner_male=max(primary_earner_male)  
drop primary_earner_male
rename max_primary_earner_male primary_earner_male
label var primary_earner_male "Husband is the primary earner"

* price adjustment
merge m:1 year using CPI.dta
keep if _merge==3
drop _merge
g cpi_ratio = 179.87/cpi
foreach x in male_labor_income fem_labor_income fam_income1000_beforetax{
	replace `x'=`x'*cpi_ratio
} 

* education 
gen hs_below=(educ<6)
gen hs_grad=(educ==6) 
gen attended_college=(educ>=7 & educ<=8) 
gen college_grad=(educ==10| educ==11)
gen male_hs_grad= hs_grad if male==1
gen male_attended_college=attended_college if male==1
gen male_college_grad=college_grad if male==1
gen fem_hs_grad= hs_grad if male==0
gen fem_attended_college=attended_college if male==0
gen fem_college_grad=college_grad if male==0
label var male_hs_grad "Husband high school graduate"  
label var male_attended_college "Husband attended college"
label var male_college_grad "Husband college graduate"
label var fem_hs_grad  "Wife high school graduate"
label var fem_attended_college  "Wife attended college"
label var fem_college_grad "Wife college graduate"
 

foreach x in fem_age fem_race_white fem_race_black fem_race_hisp fem_labor_income fem_hs_grad fem_attended_college fem_college_grad{
	bysort year serial: egen `x'_max=max(`x') 
}
keep if male==1 
drop fem_age fem_race_white fem_race_black fem_race_hisp fem_labor_income fem_hs_grad fem_attended_college fem_college_grad
rename *_max *
label var fem_age "Wife age"
label var fem_hs_grad  "Wife high school graduate"
label var fem_attended_college  "Wife attended college"
label var fem_college_grad "Wife college graduate"
label var fem_race_white "Wife white"
label var fem_race_black "Wife black"
label var fem_race_hisp "Wife hispanic"
label var fem_labor_income "Wife labor income"
foreach var of varlist fam_income1000_beforetax fam_size male_age fem_age male_hs_grad male_attended_college male_college_grad fem_hs_grad  fem_attended_college ///
 fem_college_grad male_race_white male_race_black male_race_hisp fem_race_white  fem_race_black fem_race_hisp  male_labor_income fem_labor_income primary_earner_male   {
local label`var':variable label `var'    
}
svyset [pw = hhwt] 
svy: mean fam_income1000_beforetax  fam_size male_age fem_age male_hs_grad male_attended_college male_college_grad fem_hs_grad  fem_attended_college ///
 fem_college_grad male_race_white male_race_black male_race_hisp fem_race_white  fem_race_black fem_race_hisp  male_labor_income fem_labor_income primary_earner_male 
estat sd
mat mean=r(mean)'
mat sd=r(sd)'
local n=rowsof(sd)
mat est=J(`n',2,.)
mat colnames est=Mean SD
forval i=1/	`n'{
mat est[`i',1]=mean[`i',1]
mat est[`i',2]=sd[`i',1]
}
mat list est, format(%12.3fc)
mat rownames est="`labelfam_income1000_beforetax'" "`labelfam_size'" "`labelmale_age'" "`labelfem_age'" "`labelmale_hs_grad'" "`labelmale_attended_college'" "`labelmale_college_grad'" "`labelfem_hs_grad'"  "`labelfem_attended_college'"  "`labelfem_college_grad'" "`labelmale_race_white'" "`labelmale_race_black'"  "`labelmale_race_hisp'" "`labelfem_race_white'"   "`labelfem_race_black'" "`labelfem_race_hisp'"   "`labelmale_labor_income'" "`labelfem_labor_income'"  "`labelprimary_earner_male'" 
mat list est, format(%12.3fc)



 

//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Table 2 ///////////////////////////////////

use PSID_Donation_with_Bartik_Cleaned.dta, clear 
svyset ER31997 [pweight=family_weight], singleunit(certainty) strata(ER31996) 
label var male_age "Husband age"
label var fem_age "Wife age"
label var male_hs_grad "Husband high school graduate"
label var fem_hs_grad "Wife high school graduate"
label var male_attended_college "Husband attended college"
label var fem_attended_college "Wife attended college"
label var male_college_grad "Husband college graduate"
label var fem_college_grad "Wife college graduate"
label var male_race_white "Husband white"
label var fem_race_white "Wife white"
label var male_race_black "Husband black"
label var fem_race_black "Wife black"
label var male_race_hisp "Husband hispanic"
label var fem_race_hisp "Wife hispanic"
label var fam_size "Family size"
label var male_labor_income "Husband labor income"
label var fem_labor_income "Wife labor income"
label var male_churchgoer "Husband churchgoer"
label var fem_churchgoer "Wife churchgoer"
label var male_church "Husband churchgoer"
label var fem_church "Wife churchgoer"
label var ln_price_giving "Ln(Tax price of giving)"
label var ln_fam_income "Ln(After-tax family income in \\$1,000)" 
label var wealth "Family wealth"

replace wealth=wealth/10000
label var wealth "Family wealth in \\$10,000"
local controls male_age fem_age male_hs_grad male_attended_college male_college_grad fem_hs_grad fem_attended_college fem_college_grad male_race_white fem_race_white male_race_black fem_race_black male_race_hisp fem_race_hisp male_churchgoer fem_churchgoer fam_size wealth ln_fam_income ln_price_giving

reghdfe donate_above25 `controls' [pw=family_weight], ab(statefip year) vce(cluster statefip) 
reghdfe IHS_total_amount_donation `controls'[pw=family_weight], ab(statefip year) vce(cluster statefip) 
reghdfe totaldonate_famincome_share `controls' [pw=family_weight], ab(statefip year) vce(cluster statefip) 





//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Table 3 ///////////////////////////////////

use PSID_Donation_with_Bartik_Cleaned.dta, clear

summ femwage [aweight= family_weight ], detail
local count_v1 = r(N)
local mean_v1 = string(r(mean), "%9.3f")
local min_v1 = string(r(min), "%9.3f")  
local p1_v1 = string(r(p1), "%9.3f")
local p25_v1 = string(r(p25), "%9.3f")
local p50_v1 = string(r(p50), "%9.3f")
local p75_v1 = string(r(p75), "%9.3f")
local p99_v1 = string(r(p99), "%9.3f")
local max_v1 = string(r(max), "%9.3f")
local sd_v1=string(r(sd), "%9.3f")

summ malewage [aweight= family_weight ], detail
local count_v2 = r(N)
local mean_v2 = string(r(mean), "%9.3f")
local min_v2 = string(r(min), "%9.3f")  
local p1_v2 = string(r(p1), "%9.3f")
local p25_v2 = string(r(p25), "%9.3f")
local p50_v2 = string(r(p50), "%9.3f")
local p75_v2 = string(r(p75), "%9.3f")
local p99_v2 = string(r(p99), "%9.3f")
local max_v2 = string(r(max), "%9.3f")
local sd_v2 = string(r(sd), "%9.3f")

summ ratiow [aweight= family_weight ], detail
local count_v3 = r(N)
local mean_v3 = string(r(mean), "%9.3f")
local min_v3 = string(r(min), "%9.3f")  
local p1_v3 = string(r(p1), "%9.3f")
local p25_v3 = string(r(p25), "%9.3f")
local p50_v3 = string(r(p50), "%9.3f")
local p75_v3 = string(r(p75), "%9.3f")
local p99_v3 = string(r(p99), "%9.3f")
local max_v3 = string(r(max), "%9.3f")
local sd_v3 = string(r(sd), "%9.3f")



//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Table 4 ///////////////////////////////////


use PSID_Donation_with_Bartik_Cleaned.dta, clear

/*Male*/
preserve
collapse (mean) male_labor_income malewage fam_size fam_income  wealth ln_price_giving  male_age male_agesq fem_age fem_agesq fem_hs_grad fem_attended_college fem_college_grad fem_race_white fem_race_black fem_race_hisp fem_race_asian fem_race_other (sum) family_weight, by(year statefip malerace maleedu) 
gen wealth_square=wealth*wealth
local controls fam_size wealth wealth_square male_age male_agesq fem_age fem_agesq fem_hs_grad fem_attended_college fem_college_grad fem_race_white fem_race_black fem_race_hisp fem_race_asian 
keep if male_labor_income>0 & male_labor_income!=.
ivreg2 male_labor_income malewage `controls' i.year i.statefip i.malerace i.maleedu i.malerace#c.year i.maleedu#c.year i.statefip#c.year [pw=family_weight], cluster(statefip) partial(`controls' i.year i.statefip i.malerace i.maleedu i.malerace#c.year i.maleedu#c.year i.statefip#c.year)
local partialr2 = e(r2)
reghdfe male_labor_income malewage `controls' [pw=family_weight], ab(i.year i.statefip i.malerace i.maleedu i.malerace#c.year i.maleedu#c.year i.statefip#c.year) vce(cluster statefip)
test malewage
label var malewage "Male Wage (Potential)"
restore


/*Female*/
preserve
collapse (mean) fem_labor_income femwage fam_size fam_income wealth ln_price_giving male_age male_agesq fem_age fem_agesq male_hs_grad male_attended_college male_college_grad male_race_white male_race_black male_race_hisp male_race_asian male_race_other (sum) family_weight, by(year statefip femrace femedu) 
gen wealth_square=wealth*wealth
keep if fem_labor_income>0 & fem_labor_income!=.
local controls fam_size wealth wealth_square male_age male_agesq fem_age fem_agesq male_hs_grad male_attended_college male_college_grad male_race_white male_race_black male_race_hisp male_race_asian 
ivreg2 fem_labor_income femwage `controls' i.year i.statefip i.femrace i.femedu i.femrace#c.year i.femedu#c.year i.statefip#c.year [pw=family_weight], cluster(statefip) partial(`controls' i.year i.statefip i.femrace i.femedu i.femrace#c.year i.femedu#c.year i.statefip#c.year)
local partialr2 = e(r2)
reghdfe fem_labor_income femwage `controls' [pw=family_weight], ab(i.year i.statefip i.femrace i.femedu i.femrace#c.year i.femedu#c.year i.statefip#c.year) vce(cluster statefip)
test femwage 
label var femwage "fem Wage (Potential)"
restore


/*Ratio*/
preserve
collapse (mean) male_labor_income fem_labor_income ratiow fam_size fam_income wealth ln_price_giving male_age male_agesq fem_age fem_agesq fem_hs_grad fem_attended_college fem_college_grad  fem_race_white fem_race_black fem_race_hisp fem_race_asian fem_race_other (sum) family_weight, by(year statefip malerace maleedu femrace femedu) 
gen wealth_square=wealth*wealth
g ratio = fem_labor_income/male_labor_income if male_labor_income>0 & fem_labor_income>0 
sum ratio, d 
replace ratio=. if ratio>r(p99) | ratio<r(p1) 
local controls fam_size wealth wealth_square male_age male_agesq fem_age fem_agesq 
reghdfe ratio ratiow `controls' [pw=family_weight] , ab(i.year i.statefip i.malerace i.maleedu i.femrace i.femedu i.malerace#c.year i.maleedu#c.year i.statefip#c.year) vce(cluster statefip)
test ratiow
label var ratiow "Wage Ratio (Potential)"
restore


/*Cross-effects*/ 
collapse (mean) male_labor_income fem_labor_income malewage femwage fam_size fam_income wealth ln_price_giving male_age male_agesq fem_age fem_agesq fem_hs_grad fem_attended_college fem_college_grad fem_race_white fem_race_black fem_race_hisp fem_race_asian fem_race_other  (sum) family_weight, by(year statefip malerace maleedu) 
gen wealth_square=wealth*wealth
local controls fam_size wealth wealth_square male_age male_agesq fem_age fem_agesq fem_hs_grad fem_attended_college fem_college_grad fem_race_white fem_race_black fem_race_hisp fem_race_asian  
local fevars i.statefip i.year i.maleedu i.malerace
local timetrend i.statefip#c.year i.malerace#c.year i.maleedu#c.year
keep if male_labor_income>0 & fem_labor_income>0
reghdfe male_labor_income malewage femwage `controls' [pw=family_weight], ab(`fevars' `timetrend') vce(cluster statefip)
reghdfe fem_labor_income femwage malewage `controls'  [pw=family_weight], ab(`fevars' `timetrend') vce(cluster statefip) 
label var femwage "Potential female wage"
label var malewage "Potential male wage"




///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// Table 5 ///////////////////////////////////

use PSID_Donation_with_Bartik_Cleaned.dta, clear
svyset ER31997 [pweight=family_weight], singleunit(certainty) strata(ER31996) 

label var donate_above25 "Donated (=1)"
label var ratiow "Female wage/male wage"
label var IHS_total_amount_donation "IHS(Amount)"
label var ln_total_amount_donation "Ln(Amount+1)"
label var totaldonate_famincome_share "Share (%), Donate amount/Family income"

/*Panel A*/
local controls fam_size wealth wealth_square male_age male_agesq fem_age fem_agesq 
reghdfe donate_above25 ratiow `controls' [pw=family_weight], ab(statefip year i.maleedu i.femedu i.femrace i.malerace i.statefip#c.year i.malerace#c.year i.maleedu#c.year) vce(cluster statefip)
reghdfe IHS_total_amount_donation ratiow `controls' [pw=family_weight], ab(statefip year i.maleedu i.femedu i.femrace i.malerace i.statefip#c.year i.malerace#c.year i.maleedu#c.year) vce(cluster statefip)
reghdfe totaldonate_famincome_share ratiow `controls' [pw=family_weight], ab(statefip year i.maleedu i.femedu i.femrace i.malerace i.statefip#c.year i.malerace#c.year i.maleedu#c.year) vce(cluster statefip) 

/*Panel B*/
local controls fam_size wealth wealth_square fam_income ln_price_giving male_age male_agesq fem_age fem_agesq 
reghdfe donate_above25 ratiow `controls' [pw=family_weight], ab(statefip year i.maleedu i.femedu i.femrace i.malerace i.statefip#c.year i.malerace#c.year i.maleedu#c.year) vce(cluster statefip)
reghdfe IHS_total_amount_donation ratiow `controls' [pw=family_weight], ab(statefip year i.maleedu i.femedu i.femrace i.malerace i.statefip#c.year i.malerace#c.year i.maleedu#c.year) vce(cluster statefip)
reghdfe totaldonate_famincome_share ratiow `controls' [pw=family_weight], ab(statefip year i.maleedu i.femedu i.femrace i.malerace i.statefip#c.year i.malerace#c.year i.maleedu#c.year) vce(cluster statefip)



//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////// Table 6 ////////////////////////////////

use PSID_Donation_with_Bartik_Cleaned.dta, clear

/*Panel A*/
local controls fam_size wealth wealth_square male_age male_agesq fem_age fem_agesq  
foreach var in rel_famincome combo_famincome needy_famincome health_famincome educ_famincome youthfam_famincome cultural_famincome community_famincome environment_famincome peace_famincome other_famincome{
reghdfe `var'_share ratiow `controls' [pw=family_weight], ab(statefip year i.maleedu i.femedu i.femrace i.malerace i.statefip#c.year i.malerace#c.year i.maleedu#c.year) vce(cluster statefip) 
}

/*Panel B*/  
local controls fam_size wealth wealth_square fam_income ln_price_giving male_age male_agesq fem_age fem_agesq 
foreach var in rel_famincome combo_famincome needy_famincome health_famincome educ_famincome youthfam_famincome cultural_famincome community_famincome environment_famincome peace_famincome other_famincome{
reghdfe `var'_share ratiow `controls' [pw=family_weight], ab(statefip year i.maleedu i.femedu i.femrace i.malerace i.statefip#c.year i.malerace#c.year i.maleedu#c.year) vce(cluster statefip)
}



/////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Table 7 //////////////////////////////////

use PSID_Donation_with_Bartik_Cleaned.dta, clear
gen joint_decide=(how_decide==2)
gen separate_decide=(how_decide==3)
order joint_decide, after(fem_decide)
order separate_decide, after(fem_decide)  
replace fem_decide=0 if fem_decide==.
replace male_decide=0 if male_decide==.
count if how_decide==. & (wave_year==2003 |wave_year==2005)
foreach x in male_decide fem_decide separate_decide joint_decide{
replace `x'=. if how_decide==. & (wave_year==2003 |wave_year==2005)
replace `x'=. if wave_year!=2003 & wave_year!=2005
}

svyset ER31997 [pweight=family_weight], singleunit(certainty) strata(ER31996) 
local controls fam_size wealth wealth_square male_age male_agesq fem_age fem_agesq  
local fevars i.statefip i.year i.maleedu i.femedu i.femrace i.malerace
local timetrend i.statefip#c.year i.malerace#c.year i.maleedu#c.year

preserve 
replace malerace = 4 if malerace >= 4
replace femrace = 4 if femrace >= 4
* Husband decide
reghdfe  male_decide ratiow `controls' [pw=family_weight] , ab(`fevars' ) vce(cluster statefip)
* Wife decide
reghdfe  fem_decide ratiow `controls' [pw=family_weight], ab(`fevars' ) vce(cluster statefip)
* Joint decide
reghdfe  joint_decide ratiow `controls'  [pw=family_weight], ab(`fevars' ) vce(cluster statefip)
* Separately decide
reghdfe  separate_decide ratiow `controls' [pw=family_weight] , ab(`fevars' ) vce(cluster statefip)
restore


local controls fam_size wealth wealth_square male_age male_agesq fem_age fem_agesq 
local fevars i.statefip i.year i.maleedu i.femedu i.femrace i.malerace
local timetrend i.statefip#c.year i.malerace#c.year i.maleedu#c.year
* Family Income (Post-tax)
sum fam_income, d
replace fam_income = . if fam_income > `r(p99)'
reghdfe fam_income ratiow `controls' [pw=family_weight] , ab(`fevars' `timetrend') vce(cluster statefip)
* Family Income (Pre-tax)
sum fam_income_beforetax, d
replace fam_income_beforetax = . if fam_income_beforetax > `r(p99)'
reghdfe fam_income_beforetax ratiow `controls' [pw=family_weight], ab(`fevars' `timetrend') vce(cluster statefip)
* Tax price of giving
reghdfe price_giving ratiow `controls' [pw=family_weight], ab(`fevars' `timetrend') vce(cluster statefip)
* Male Churchgoer
reghdfe male_churchgoer ratiow `controls' [pw=family_weight] if (wave_year==2003|wave_year==2005|wave_year==2011|wave_year==2017|wave_year==2019) & family_weight>0, ab(`fevars' `timetrend') vce(cluster statefip)
* Female Churchgoer
reghdfe fem_churchgoer ratiow `controls' [pw=family_weight] if (wave_year==2003|wave_year==2005|wave_year==2011|wave_year==2017|wave_year==2019) & family_weight>0, ab(`fevars' `timetrend') vce(cluster statefip)
label var male_decide "Husband"
label var fem_decide "Wife"
label var joint_decide "Joint"
label var separate_decide "Separate"
label var male_churchgoer "Husband"
label var fem_churchgoer "Wife"
label var fam_income "Post-tax"
label var fam_income_beforetax "Pre-tax"
label var price_giving "Price of giving"





/////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// Table 8 //////////////////////////////////////

/* Table 8 of Section 9.3 explores results using the manufacturing shock at 
the commuting-zone level and utilizes the PSID at the county level, which is confidential
and cannot be shared publicly. Access to PSID restricted data requires a 
contract with the University of Michigan. */





/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Figure 1 //////////////////////////////////////

/*(a)*/
use PSID_Donation_with_Bartik_Cleaned.dta, clear 
svyset ER31997 [pweight=family_weight], strata(ER31996) 
foreach var in total_amount_donation donate_religious_amount donate_combo_amount donate_needy_amount donate_health_amount donate_educ_amount donate_youthfam_amount donate_cultural_amount donate_community_amount donate_environment_amount donate_peace_amount donate_other_amount{
eststo `var':svy: reg `var' 
}
label var total_amount_donation  "Total Donations"
label var donate_religious_amount "Religious"
label var donate_combo_amount "Combo Purpose"
label var donate_needy_amount   "Needy"
label var donate_health_amount "Health"
label var donate_educ_amount  "Education"
label var donate_youthfam_amount  "Youth/Family"
label var donate_cultural_amount "Cultural"
label var donate_community_amount "Neighborhood/Community"
label var donate_environment_amount "Environment"
label var donate_peace_amount "International Aid/World Peace"
label var donate_other_amount "Other"
coefplot total_amount_donation donate_religious_amount donate_combo_amount donate_needy_amount donate_health_amount donate_educ_amount donate_youthfam_amount donate_cultural_amount donate_community_amount donate_environment_amount donate_peace_amount donate_other_amount, label asequation swapnames legend(off) graphregion(color(white)) ///
recast(bar) barwidt(0.3) offset(0) xtitle("Amount in USD")

/*(b)*/
use PSID_Donation_with_Bartik_Cleaned.dta, clear 
svyset ER31997 [pweight=family_weight], strata(ER31996) 
foreach var in totaldonate_famincome_share rel_famincome_share combo_famincome_share needy_famincome_share health_famincome_share educ_famincome_share youthfam_famincome_share cultural_famincome_share community_famincome_share environment_famincome_share peace_famincome_share other_famincome_share{
eststo `var':svy: reg `var' 
}
label var totaldonate_famincome_share "Total Donations"
label var rel_famincome_share "Religious"
label var combo_famincome_share "Combo Purpose"
label var needy_famincome_share   "Needy"
label var health_famincome_share "Health"
label var educ_famincome_share  "Education"
label var youthfam_famincome_share  "Youth/Family"
label var cultural_famincome_share "Cultural"
label var community_famincome_share "Neighborhood/Community"
label var environment_famincome_share "Environment"
label var peace_famincome_share "International Aid/World Peace"
label var other_famincome_share "Other"
coefplot  totaldonate_famincome_share rel_famincome_share combo_famincome_share needy_famincome_share health_famincome_share educ_famincome_share youthfam_famincome_share cultural_famincome_share community_famincome_share environment_famincome_share peace_famincome_share other_famincome_share, label asequation swapnames legend(off) graphregion(color(white)) ///
recast(bar) barwidt(0.3) offset(0) ///
xtitle("Shares (%)") 


/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Figure 2 //////////////////////////////////////

use Bartik_wo_EduRace.dta, clear
keep year statefip ratiow malewage femwage
reshape wide ratiow malewage femwage, i(statefip) j(year)
merge 1:1 statefip using "State_map/cb_2018_us_state_500k/usdb.dta"
keep if _merge == 3
g diff_f = ln(femwage2018) - ln(femwage2002)
g diff_m = ln(malewage2018) - ln(malewage2002)
format diff_m %12.2f
format diff_f %12.2f
spmap diff_m using "State_map/cb_2018_us_state_500k/uscoord" if  statefip!=2 & statefip!=15, id(id) fcolor(Blues) legend(size(*2.8))
spmap diff_f using "State_map/cb_2018_us_state_500k/uscoord" if  statefip!=2 & statefip!=15, id(id) fcolor(Blues) legend(size(*2.8))
	
	

	